﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package org.aswing.util {
    import flash.utils.*;

    public class HashSet {

        private var container:Dictionary;
        private var length:int;

        public function HashSet(){
            this.container = new Dictionary();
            this.length = 0;
        }
        public function size():int{
            return (this.length);
        }
        public function add(_arg1):void{
            if (!this.contains(_arg1)){
                this.length++;
            };
            this.container[_arg1] = _arg1;
        }
        public function contains(_arg1):Boolean{
            return (!((this.container[_arg1] === undefined)));
        }
        public function isEmpty():Boolean{
            return ((this.length == 0));
        }
        public function remove(_arg1):Boolean{
            if (this.contains(_arg1)){
                delete this.container[_arg1];
                this.length--;
                return (true);
            };
            return (false);
        }
        public function clear():void{
            this.container = new Dictionary();
            this.length = 0;
        }
        public function addAll(_arg1:Array):void{
            var _local2:*;
            for each (_local2 in _arg1) {
                this.add(_local2);
            };
        }
        public function removeAll(_arg1:Array):void{
            var _local2:*;
            for each (_local2 in _arg1) {
                this.remove(_local2);
            };
        }
        public function containsAll(_arg1:Array):Boolean{
            var _local2:int;
            while (_local2 < _arg1.length) {
                if (!this.contains(_arg1[_local2])){
                    return (false);
                };
                _local2++;
            };
            return (true);
        }
        public function each(_arg1:Function):void{
            var _local2:*;
            for each (_local2 in this.container) {
                _arg1(_local2);
            };
        }
        public function toArray():Array{
            var _local3:*;
            var _local1:Array = new Array(this.length);
            var _local2:int;
            for each (_local3 in this.container) {
                _local1[_local2] = _local3;
                _local2++;
            };
            return (_local1);
        }

    }
}//package org.aswing.util 
